namespace WindowsFormsQuickStart._1120;

public partial class Form2 : Form
{
    public Form2()
    {
        InitializeComponent();
    }
    
    //通过点击button3可以让用户选择他的图片中的某个值，并将图片另存到D:\AppGallery\RiderProjects\1120picture地址下，同时将图片插入到picturebox中
    private void button3_Click(object sender, EventArgs e)
    { 
        OpenFileDialog openFileDialog1 = new OpenFileDialog();
        if (openFileDialog1.ShowDialog() == DialogResult.OK)
        {
            string uuid = Guid.NewGuid().ToString();
            string path = "D:\\AppGallery\\RiderProjects\\1120picture\\" + uuid + ".jpg";
            File.Copy(openFileDialog1.FileName, path);
            pictureBox1.Image = Image.FromFile(path);
        }
    }
    
    //通过点击button2可以保存pictureBox中的信息到D:\AppGallery\RiderProjects\1120picture地址下
    private void button2_Click(object sender, EventArgs e)
    {
        string uuid = Guid.NewGuid().ToString();
        string path = "D:\\AppGallery\\RiderProjects\\1120picture\\" + uuid + ".jpg";
        pictureBox1.Image.Save(path);
    }
    
    
}